// Z pass.
// out put normal, depth, and world position. 
// define VPASS_PREPASS
// dummy shader. 

#include <MaterialVertex>

struct ZPassV2F 
{
	float4 HPos : POSITION;
	float4 TexCoord : TEXCOORD0;
	float ZInfo:TEXCOORD1;
#if HAS_TANGENTSPACE 
	float3 Tangent : TEXCOORD2;	
	float3 Binormal : TEXCOORD3;
	float3 Normal : TEXCOORD4;
#else
	half3 Normal:TEXCOORD2;
#endif 
};

ZPassV2F VMain(VVertexInput Input)
{
	ZPassV2F OUT = (ZPassV2F)0;
	// init vertex context.
	VVertexContext vCtx = VInitVertexContext(Input);

	//
	OUT.HPos = vCtx.HPos;
	OUT.TexCoord = vCtx.TexCoord;

	//OUT.WorldPos = vCtx.Position * DepthRange.w;
	OUT.ZInfo = vCtx.HPos.w * DepthRange.w;		// linear depth. 
#if HAS_TANGENTSPACE
	OUT.Tangent = vCtx.TangentToWorld[0];
	OUT.Binormal = vCtx.TangentToWorld[1];
	OUT.Normal = vCtx.TangentToWorld[2];
#else 
	OUT.Normal = vCtx.Normal;
#endif 

	return OUT;
}